package com.usian.controller;

import com.usian.pojo.*;
import com.usian.service.ConsigneeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author 像风如你
 */
@RestController
@RequestMapping("consignee")
@CrossOrigin(allowedHeaders = "*")
public class ConsigneeController {
    @Autowired
    private ConsigneeService consigneeService;

    @PostMapping("findPage")
    public PageResult findPage(@RequestBody QueryPageBean queryPageBean){
        return consigneeService.findPage(queryPageBean);
    }

    @GetMapping("findPCC/{id}")
    public List<Region> findCounty(@PathVariable Integer id){
        return consigneeService.findPCC(id);
    }

    @GetMapping("findById/{id}")
    public Consignee findById(@PathVariable Integer id){
        return consigneeService.findById(id);
    }

    @GetMapping("deleteById/{id}")
    public void deleteById(@PathVariable Integer id){
        consigneeService.deleteById(id);
    }

    @PostMapping("addConsignee")
    public void addConsignee(@RequestBody Consignee consignee){
            consigneeService.addConsignee(consignee);
    }

    @PostMapping("upConsignee")
    public void upConsignee(@RequestBody Consignee consignee){
        consigneeService.upConsignee(consignee);
    }

    @GetMapping("deleteConsignee")
    public void deleteConsignee(@RequestParam String ids){
        consigneeService.deleteConsignee(ids);
    }
}
